#pragma once

#include <malloc.h>

class RefCountBase
{
public:
	RefCountBase(void);
	~RefCountBase(void);
	void *operator new( unsigned int num_bytes)
    {	
		return malloc(num_bytes);
    }

	void AddRef()
	{
		refCount++;
	}

	void operator delete(void* p)
	{
		refCount--;
		if(refCount<=0)
			free(p);
	}


private:
	static int refCount;
};
